package dao.impl;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.springframework.stereotype.Repository;

import dao.DishDao;
import po.Dish;

@Repository("dishDao")
public class DishDaoImpl implements DishDao{

	@PersistenceContext(name="un")
	private EntityManager em;
	
	@Override
	public List<Dish> getAdDish(List<String> didList) {
		String jpql = "from Dish where did in (:didList)";
		didList.add("testadddish");
		return em.createQuery(jpql).setParameter("didList", didList).getResultList();
	}
	
	@Override
	public Dish findDishByDid(String did) {
		Dish dish=em.find(Dish.class, did);
		return dish;
	}
}
